<?php $this->_extends('_layouts/default_layout'); ?>
 
<?php $this->_block('contents'); ?>
 
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>js/jquery.js"></script> 
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>js/ajaxfileupload.js"></script> 

<link href="<?php echo $_BASE_DIR; ?>plugins/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>plugins/xheditor/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>plugins/xheditor/xheditor-1.1.11-zh-cn.min.js "></script>
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>plugins/uploadify/swfobject.js"></script>
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>plugins/uploadify/jquery.uploadify.v2.1.4.min.js"></script>

    <br/>


<h3>栏目编辑</h3>
    <br/>

<form id="form_usersetting" name="form_usersetting" action="<?php echo url('column/edit'); ?>" method="post" enctype="application/x-www-form-urlencoded" qform_group_id="" 
        onsubmit="
		if (this.column_title.value == '') { 
		alert('请输入栏目标题'); 
		return false; }
		else { 
			if (this.column_desc.value == '') 
			{ 
				alert('请输入栏目描述'); 
				return false; 
			}
			else if (this.column_seqence.value == '') 
			{ 
				alert('请输入栏目序号'); 
				return false; 
			}
			return true; 
		}"
>
<div id="filesUploaded" name="filesUploaded">
       <?php if(strlen($col->column_logo)>0): ?>
            <img src="<?php echo $col->column_logo ?>" style=""/>
		<?php endif; ?>	
</div>
    <input id="file_upload" type="file" name="Filedata" /> </p>
        <script type="text/javascript">
$(function() {
    $('#file_upload').uploadify({
        'uploader'  : '<?php echo $_BASE_DIR; ?>plugins/uploadify/uploadify.swf',
            'script'    : '<?php echo $_BASE_DIR; ?>plugins/uploadify/uploadify.php',
            'cancelImg' : '<?php echo $_BASE_DIR; ?>plugins/uploadify/cancel.png',
            'folder'    : '<?php echo $_BASE_DIR; ?>upload/enterprise_logo',
            'removeCompleted' : true,
            'fileDesc'  : '图片文件',
            'fileExt'   : '*.jpg;*.bmp;*.png;*.gif',
            'sizeLimit' : 1024 * 1024 * 2,
            'onComplete': function(event, queueID, fileObj, response, data) 
        {
            while(filesUploaded.firstChild)
            {
                var oldNode = filesUploaded.removeChild(filesUploaded.firstChild);
                oldNode = null;
            }
            $('#filesUploaded').append('<img src='+response+' style="max-width:300px;"/><input type="hidden" value='+response+' name="upload_pic" />');

        }
    }); });
    </script>

    <a href="javascript:$('#file_upload').uploadifyUpload()">上传</a>

        <br/>
		<br/>


  <fieldset>
    

  <p id="column_name" >
    <label for="column_title">栏目标题&nbsp;</label>
     <label><span class="error" name="warn_name" style="display:none" id="10014">请输入栏目标题</span></label>
    <input type="text"  id="10013" name="column_title" onBlur="CheckIsNull(10013, 10014)" value="<?php echo $col->column_name ?>" class="textbox_short" />
  </p>


  <p id="column_desc" >
    <label for="column_desc">栏目描述&nbsp;</label>
    
    <label><span class="error" name="warn_phone" style="display:none" id="10016">请输入栏目描述</span></label>
    <textarea type="num"  id="10015" name="column_desc" onBlur="CheckIsNull(10015, 10016)" class="textbox" rows="10"><?php echo $col->column_desc ?></textarea>
  </p>

  <p id="column_seqence" >
    <label for="column_seqence">栏目序号</label>
    
    <label><span class="error" style="display:none" id="10017">请输入栏目序号</span></label>
    
    <input type="text"  id="10018" name="column_seqence"  value="<?php echo $col->column_sequence ?>" onBlur="CheckIsNull(10018, 10017)" class="textbox_short" />
  </p>

  <input type="hidden" name="column_id" id="column_id" value="<?php echo $col->id() ?>" />
  <!-----------
   <p id="column_hide_or_not" >        
	 <label><input type="checkbox" name="column_hide_or_not"  id="checkboxid" value="<?php echo $col->column_status ?>" /><span>栏目隐藏否</span> </label>
   </p>
	--------------->

   <p>
   <input type="submit" name="btn_submit" value="发送" class="btn" />      
   </p>

  </fieldset>
<script>
	function   LTrim(str)           //   左空格 
	{   
			var   i=0;  
			for(i=0;i <str.length;i++)   
			{   
			if(str.charAt(i)!= "   "&&str.charAt(i)!= "   ")break;
			}   
			str=str.substring(i,str.length);   
			return   str;   
	}   
	function   Trim(str)     //   两边空格 
	{   
			return   LTrim(str);   
	}  

    function CheckIsNull(check_id, des_id)
	{
        var name = document.getElementById(check_id);
		if("" == name.value || Trim(name.value)== " ")
		{				
			var objSrc = document.getElementById(des_id);
			objSrc.style.display = "";
		} 
		else
		{
			var objSrc = document.getElementById(des_id);
			objSrc.style.display = "none";
		}
	}
</script>

</form><?php $this->_endblock(); ?>